// CSPRDsy.cpp : implementation file
//

#include "stdafx.h"
#include "dbconvert.h"
#include "CSPRsy.h"
#include "CSPRDalian.h"
#include "DBConvertDlg.h"
#include "DBsetdata.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CCSPRsy dialog
extern CDBConvertApp theApp;

CCSPRsy::CCSPRsy(CWnd* pParent /*=NULL*/)
	: CDialog(CCSPRsy::IDD, pParent)
{
	//{{AFX_DATA_INIT(CCSPRsy)
	m_pathName = _T("");
	//}}AFX_DATA_INIT
}

void CCSPRsy::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CCSPRsy)
	DDX_Text(pDX, IDC_EDIT1, m_pathName);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CCSPRsy, CDialog)
	//{{AFX_MSG_MAP(CCSPRsy)
	ON_COMMAND(ID_syConstMENUITEM, OnsyConstMENUITEM)
	ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
	ON_BN_CLICKED(IDC_BUTTON_WEIGHT, OnButtonWeight)
	ON_BN_CLICKED(IDC_CREATE_HDCrude, OnCreateHDCrude)
	ON_BN_CLICKED(IDC_Create_LugDiaofCSPRSY, OnCreateLugDiaofCSPRSY)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCSPRsy message handlers

void CCSPRsy::OnsyConstMENUITEM() 
{
	// TODO: Add your command handler code here
	
}

void CCSPRsy::OnButton3() 
{
	CString strDBPath;

	strDBPath = ((CDBConvertDlg*)(theApp.m_pMainWnd))->GetDBPath();
	try
	{
		if ( !strDBPath.IsEmpty() )
		{
			m_pathName = strDBPath;
			CDBSetData::Instance().SetDBPath( strDBPath );
		}
	}
	catch(_com_error e)
	{
		AfxMessageBox(e.Description());
	}
	UpdateData( FALSE );
}

void CCSPRsy::OnButtonWeight() 
{
	// TODO: Add your control notification handler code here
	
	CDBSetData::Instance().WriteWeight();
}

int CCSPRsy::DoModal() 
{
	// TODO: Add your specialized code here and/or call the base class
	return CDialog::DoModal();
}

void CCSPRsy::OnCreateHDCrude() 
{
	CDBSetData::Instance().CreateHDCrude();	
}

void CCSPRsy::OnCreateLugDiaofCSPRSY() 
{
	CDBSetData::Instance().CreateRODDiaofCSPR();		
}
